package com.starsea.book.ui.newpage.utils

import android.graphics.drawable.Drawable

/**
 * Function: Drawable设置相关工具类
 * Description:
 */
object DrawableUtil {
    /**
     * 设置drawable宽高
     *
     * @param drawable
     * @param width
     * @param height
     */
    fun setDrawableWidthHeight(drawable: Drawable?, width: Int, height: Int) {
        try {
            drawable?.setBounds(
                0, 0,
                if (width >= 0) width else drawable.intrinsicWidth,
                if (height >= 0) height else drawable.intrinsicHeight
            )
        } catch (e: Exception) {
        }
    }
}